package 第十周.homework;

import 第十周.practice.Magazine;

public class Magazine1 implements Comparable {
        private String title;

        //-----------------------------------------------------------------
        //  Sets up the new magazine with its title.
        //-----------------------------------------------------------------
        public Magazine1(String newTitle)
        {
            title = newTitle;
        }

        public int compareTo(Object magazine)
       {
        int result;

        String otherTitle = ((Magazine1)magazine).title;
        result = title.compareTo(otherTitle);

        return result;
       }

        //-----------------------------------------------------------------
        //  Returns this magazine as a string.
        //-----------------------------------------------------------------
        public String toString()
        {
            return title;
        }
}
